﻿using Common.Logging;
using FsCarInfo.Core.Entity.IRespositories.Impl;
using HMIS.FrameWork.Repository.NHb;
using Quartz;

namespace HMIS.MVC.Schedulers
{
	/// <summary>
	/// 发送超时警告短信
	/// </summary>
	public class SendOverTimeWarnSms : Quartz.IJob
	{
		private static ILog _log = LogManager.GetLogger(typeof(SendOverTimeWarnSms));
		
		#region IJob  成员

		public void Execute(Quartz.IJobExecutionContext context)
		{
			_log.Info(string.Format("扫描超时的用车单，发送警告短信开始....! - {0}", System.DateTime.Now.ToString("r")));
			FsIntlVehicleApplRepositoryImpl intlVehicleApplRep = new FsIntlVehicleApplRepositoryImpl();
			intlVehicleApplRep.SendOverTimeSms();

			_log.Info(string.Format("扫描超时的商品车调拨单，发送警告短信开始....! - {0}", System.DateTime.Now.ToString("r")));
			FsCartransferRepositoryImpl carTransferRep = new FsCartransferRepositoryImpl();
			carTransferRep.SendOverTimeSms();
		}

		#endregion
	}
	
	/// <summary>
	/// 扫描并发送未发送短信
	/// </summary>
	public class ScanAndSendSMS : Quartz.IJob
	{
		private static ILog _log = LogManager.GetLogger(typeof(ScanAndSendSMS));
		//ScanAndSend

		public void Execute(Quartz.IJobExecutionContext context)
		{
			_log.Info(string.Format("扫描待发送短信....! - {0}", System.DateTime.Now.ToString("r")));
			HMIS.Infrastructure.Core.Repositories.Impl.InfraSmsRepositoryImpl smsRep = new HMIS.Infrastructure.Core.Repositories.Impl.InfraSmsRepositoryImpl();
			smsRep.ScanAndSend();
		}
	}
	
}
